<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"
    />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="./js/lib.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">web 内容管理</a>
            <a>
                <cite>视频管理</cite>
            </a>
        </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);"
            title="刷新">
            <i class="layui-icon" style="line-height:30px">ဂ</i>
        </a>
    </div>
    <div class="x-body">
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so">
                <input class="layui-input" placeholder="开始时间" name="start" id="start">
                <input class="layui-input" placeholder="结束时间" name="end" id="end">
                <div class="layui-input-inline">
                    <select name="status" lay-filter="status">
                        <option value>视频状态</option>
                        <option value="0">未发布</option>
                        <option value="1">已发布</option>
                        <option value="2">已废弃</option>
                    </select>
                </div>
                <button class="layui-btn" lay-submit="" lay-filter="search">
                    <i class="layui-icon">&#xe615;</i>
                </button>
            </form>
        </div>
        <xblock>
            <button class="layui-btn layui-btn-normal" onclick="x_admin_show('添加视频','./video-add.html')">
                <i class="layui-icon"></i>添加</button>
            <span class="x-right" style="line-height:40px">共有数据：
                <span id="count">0</span> 条</span>
        </xblock>
        <table class="layui-table">
            <thead>
                <tr>
                    <th>
                        <div class="layui-unselect header layui-form-checkbox" lay-skin="primary">
                            <i class="layui-icon">&#xe605;</i>
                        </div>
                    </th>
                    <th>视频ID</th>
                    <th>标题</th>
                    <th>视频链接</th>
                    <th>创建者</th>
                    <th>创建时间</th>
                    <th>发布时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody id="videoDatas">

            </tbody>
        </table>
        <div class="page">
            <div>
                <a class="prev">&lt;&lt;</a>
                <a class="num current">1</a>
                <a class="num">2</a>
                <a class="num">3</a>
                <a class="num">489</a>
                <a class="next">&gt;&gt;</a>
            </div>
        </div>

    </div>
    <script>
        var aId = Cookies.get('kplus-helmetAdminId');
        var aToken = Cookies.get('kplus-helmetAdminToken');
        layui.use(['laydate', 'layer', 'form'], function () {
            var laydate = layui.laydate,
                layer = layui.layer,
                form = layui.form;
            //初始化时间
            laydate.render({
                elem: '#start' 
            });
            laydate.render({
                elem: '#end'
            });
            //获取列表
            function getVideoList(query){ 
                var loadIndex1 = layer.load(1, { shade: [0.5, '#000'] });
                var newsDatasTable = $('#newsDatas');
                newsDatasTable.empty();
                $.ajax({
                    url:bAsEuRl + uRlS.video,
                    type:'GET',
                    data: query,
                    success: function (data) {
                         if (data.msg.code == 200) {
                            //console.log(data)

                            layer.close(loadIndex1)
                        } else {
                            layer.msg(data.msg.msg, { time: 4000 })
                            layer.close(loadIndex1)
                        }
                    },
                    error: function (data) { 
                        layer.close(loadIndex1)
                        layer.msg('发生严重错误，请联系管理员修复！', { time: 2000 });
                     }
                })
            }    
            getVideoList({
                'aId':aId,
                'aToken':aToken,
                'pg':'1',
                'num':'36'
            })
            form.on('submit(search)', function (query) { 
                //console.log(query)
                var filter = {
                    'aId':aId,
                    'aToken':aToken
                }
                if (query.field.start){ filter['startT'] = query.field.start + '-00:00:00' };
                if (query.field.end) { filter['endT'] = query.field.end + '-23:59:59' };
                if (query.field.status) { filter['status'] = query.field.status};
                //getVideoList(filter);
                return false;
             })
        })

    </script>

</body>

</html>